Skip to content

Validate checkedExceptionClasses config#3987

Open
janedbal wants to merge 4 commits intophpstan:2.1.xfrom
janedbal:checked-exceptions-validate-config
Open

Validate checkedExceptionClasses config#3987
janedbal wants to merge 4 commits intophpstan:2.1.xfrom
janedbal:checked-exceptions-validate-config

Conversation

@janedbal
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/Rules/Exceptions/DefaultExceptionTypeResolver.php Outdated
Comment thread src/Rules/Exceptions/DefaultExceptionTypeResolver.php Outdated
Comment thread src/Rules/Exceptions/DefaultExceptionTypeResolver.php Outdated
Copy link
Copy Markdown
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And fix the conflicts please 😊

Comment thread src/DependencyInjection/ContainerFactory.php Outdated
Validate that class names configured in checkedExceptionClasses and
uncheckedExceptionClasses actually exist, preventing silent
misconfiguration. Gated behind bleedingEdge feature toggle.

Also removes non-existent exception classes from build/phpstan.neon.

Co-Authored-By: Claude Code
@janedbal janedbal force-pushed the checked-exceptions-validate-config branch from 1986cf0 to 4c17d37 Compare March 26, 2026 16:06
The validation happens in ContainerFactory::create(), not in
DefaultExceptionTypeResolver's constructor. Tests construct
DefaultExceptionTypeResolver directly, so they are unaffected.

Co-Authored-By: Claude Code
@janedbal janedbal requested a review from ondrejmirtes March 27, 2026 11:04
ReflectionProvider needs BetterReflection to be initialized before
it can resolve classes. This happens in postInitializeContainer.

Co-Authored-By: Claude Code
DerivativeContainerFactory creates secondary containers (e.g. for stub
validation) that have different source locators. These containers set
__validate to false, so use the same guard as validateParameters.

Co-Authored-By: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants